<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateShopCouponTable extends Migration
{
    public function up()
    {
        Schema::create('shop_coupon', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->string('operator',50)->comment('操作人');
            $table->decimal('value',10,2)->comment('面值');
            $table->dateTime('end_time')->comment('有效期');
            $table->dateTime('use_time')->default('1970-01-01 00:00:00')->comment('使用时间');
            $table->boolean('usage_state')->default(false)->comment('使用状态');
            $table->string('memo')->default('')->comment('备注');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('shop_coupon');
    }
}
